<template>
    <div>
         <h3>显示数据</h3>
         <div>
            活动:
            <input type="text" v-model="info.Huodongxx">
            分类:
            <select v-model="info.Fid">
                <option value="">请选择</option>
                <option :value="item.Id" v-for="item in err">{{ item.LieName }}</option>
            </select>
            <input type="button" value="显示" @click="showall">
            
         </div>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>活动标题</td>
                    <td>图片</td>
                    <td>状态</td>
                    <td>分类</td>
                    <td>活动时间</td>
                    <td>活动地点</td>
                    <td>更新人</td>
                    <td>最后更新时间</td>
                    <td>操作</td>
                </tr>
                <tr v-for="item in info.value" :key="item.Id">
                    <td>{{ item.Huodongxx }}</td>
                    <td>
                        <img :src="item.HudongPhoto" width="60" height="60">
                    </td>
                    <td>{{ item.Stares==true?"进行中":"未进行" }}</td>
                    <td>{{ item.LieName }}</td>
                    <td>{{ moment(item.HuoTime).format('YYYY-MM-DD') }}</td>
                    <td>{{ item.Huodng }}</td>
                    <td>{{ item.Gxname }}</td>
                    <td>{{ moment(item.GxTime).format('YYYY-MM-DD') }}</td>
                    <td><input type="button" value="修改" @click="xiugai(item.Id)"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted}from 'vue'
import axios from 'axios';
import moment from 'moment';
import{useRoute,useRouter}from 'vue-router'
const route=useRoute();
const router=useRouter();
    
let info:any=reactive({
    Huodongxx:'',
    Fid:''
})

onMounted(()=>{
    showall();
    bangding();
})

//显示
const showall=()=>{
    axios({
        url:'/api/User/HuoList',
        method:'get',
        params:info
    })
    .then((res)=>{
        info.value=res.data
    })
}
//绑定下拉框
let err:any=ref([])

const bangding=()=>{
    axios({
        url:'/api/User/Binghd',
        method:'get'
    })
    .then((res)=>{
        err.value=res.data
    })
}
//修改
const xiugai=(Id:any)=>{
    router.push({
        path:'/huoUpdate',
        query:{
            id:Id
        }
        
    })
}
</script>

<style scoped>

</style>